package com.example.demo.service.impl;

import com.example.demo.dataobject.OralMedicine;
import com.example.demo.repository.OralMedicineRepository;
import com.example.demo.service.OralMedicineService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
@Slf4j
public class OralMedicineServiceImpl implements OralMedicineService {

    @Autowired
    private OralMedicineRepository oralMedicineRepository;

    @Override
    public List<OralMedicine> findAll() {
        List<OralMedicine> result = oralMedicineRepository.findAll();
        return result;

    }

    @Override
    public List<OralMedicine> findByNameLikeOrderById(String name) {
        List<OralMedicine> result = oralMedicineRepository.findByNameLikeOrderById(name);
        return result;
    }

    @Override
    public OralMedicine findByName(String name) {
        OralMedicine oralMedicine = oralMedicineRepository.findByName(name);
        return oralMedicine;
    }
}
